package com.richpay.basejava.base13.instance;

public class SingleInstanceDemo {
    public static void main(String[] args) {
        Person p1 = Person.getInstance();
        Person p2 = Person.getInstance();
        //构造方法私有化后不能使用 new 来创建对象了
        //Person p=new Person();//报错

        System.out.println(p1==p2);

        System.out.println("============");

        Dog dog1=Dog.getInstance();
        Dog dog2=Dog.getInstance();
        System.out.println(dog1==dog2);

    }
}
